/**********************************************
* @file    	i2c_ee.h
* @author 	dralee
* @version	v1.0
* @date		2021-12-05
* @brief	模拟I2C访问EEPROM
*		AT24C02	2kb=2048bit = 2048/8 B=256B
*		32 pages of 8 bytes each
* Device Address
* 1 0 1 0 A2 A1 A0 R/W
* 1 0 1 0 0  0  0  0 = 0xA0
* 1 0 1 0 0  0  0  1 = 0xA1
*
* AT24C01/02每页有8个字节
* AT24C04/08A/16A每页有16个字节
***********************************************/
#ifndef __I2C_EEPROM_H
#define __I2C_EEPROM_H

#include "stm32f10x.h"

#define EEPROM_DEV_ADDR			0xA0		// 24xx02的设备地址
#define EEPROM_PAGE_SIZE		8				// 24xx02页面大小
#define EEPROM_SIZE					256			// 24xx02总容量

uint8_t EEP_CheckOk(void);
uint8_t EEP_ReadBytes(uint8_t *pReadBuf, uint16_t usAddress, uint16_t usSize);
uint8_t EEP_WriteBytes(uint8_t *pWriteBuf, uint16_t usAddress, uint16_t usSize);
void EEP_Erase(void);
uint8_t EEP_Test(void);

#endif
